package entityJDBC;

public class Position {

	private int idPosition;
	private String name;
	private int nrPersons;
	private User user;
	private PositionDescription positionDescription;
	private PositionStatus positionStatus;

	public Position(int idPosition, String name, int nrPersons, User user,
			PositionDescription positionDescription,
			PositionStatus positionStatus) {
		super();
		this.idPosition = idPosition;
		this.name = name;
		this.nrPersons = nrPersons;
		this.user = user;
		this.positionDescription = positionDescription;
		this.positionStatus = positionStatus;
	}

	public int getIdPosition() {
		return idPosition;
	}

	public void setIdPosition(int idPosition) {
		this.idPosition = idPosition;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getNrPersons() {
		return nrPersons;
	}

	public void setNrPersons(int nrPersons) {
		this.nrPersons = nrPersons;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public PositionDescription getPositionDescription() {
		return positionDescription;
	}

	public void setPositionDescription(PositionDescription positionDescription) {
		this.positionDescription = positionDescription;
	}

	public PositionStatus getPositionStatus() {
		return positionStatus;
	}

	public void setPositionStatus(PositionStatus positionStatus) {
		this.positionStatus = positionStatus;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + idPosition;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + nrPersons;
		result = prime
				* result
				+ ((positionDescription == null) ? 0 : positionDescription
						.hashCode());
		result = prime * result
				+ ((positionStatus == null) ? 0 : positionStatus.hashCode());
		result = prime * result + ((user == null) ? 0 : user.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Position other = (Position) obj;
		if (idPosition != other.idPosition)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (nrPersons != other.nrPersons)
			return false;
		if (positionDescription == null) {
			if (other.positionDescription != null)
				return false;
		} else if (!positionDescription.equals(other.positionDescription))
			return false;
		if (positionStatus == null) {
			if (other.positionStatus != null)
				return false;
		} else if (!positionStatus.equals(other.positionStatus))
			return false;
		if (user == null) {
			if (other.user != null)
				return false;
		} else if (!user.equals(other.user))
			return false;
		return true;
	}

}